package com.eobard.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eobard.entity.User;
import com.eobard.mapper.UserMapper;
import com.eobard.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Eobard Thawne
 * @since 2022-07-31
 */
@Transactional
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    /**
     * 根据用户名查询用户
     * @param userName
     */
    @Override
    public User findUserByUsername(String userName) {
        QueryWrapper<User> wrapper=new QueryWrapper<>();
        wrapper.lambda().eq(User::getUsername,userName);
        return baseMapper.selectOne(wrapper);
    }
}
